<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'user';

    /**
     * The primary key for the model.
     *
     * @var string
     */
    protected $primaryKey = 'uid';

    protected function getDateFormat()
    {
    	return date(time());
    }

    protected $guarded = [''];

    public function userInfo()
    {
        return $this->hasOne('App\Models\UserInfo', 'uid', 'uid');
    }

    public function roleUser()
    {
        return $this->hasOne('App\Models\RoleUser', 'uid', 'uid');
    }

    public function userCategory()
    {
        return $this->hasMany('App\Models\UserCategory', 'uid', 'uid');
    }

    public function projects()
    {
        return $this->hasMany('App\Models\Project', 'uid', 'uid');
    }


    public function userInvestCategory()
    {
        return $this->hasMany('App\Models\UserInvestCategory', 'uid', 'uid');
    }

    public function zone()
    {
        return $this->belongsTo('App\Models\Zone', 'zone_id', 'id');
    }


    public function institution()
    {
        return $this->belongsTo('App\Models\Institution', 'institution_id', 'id');
    }
}
